import { TArenaPetReward } from "../../../../Message/Db/Tables/TArenaPetReward";
import { ItemData } from "./ItemData";
import { SReward } from "../../../../Message/Public/SReward";
import { JSON } from "../../../../com/mui/serialization/json/JSON";
import { EReward } from "../../../../Message/Public/EReward";
import { GameDefConfig } from "../GameDefConfig";
type int = number;
//class PetArenaRewardInfo
    
    export  class PetArenaRewardInfo extends TArenaPetReward
    {
        constructor()
        {
            
            super();this._rewardArray = [];
            this._itemDataArray = [];
            return;
        }

        public get rewardNum(): int
        {
            return this._rewardNum;
        }

        public get rewardName(): string
        {
            return this._rewardName;
        }

        public get itemData(): ItemData
        {
            return this._itemData;
        }

        public get reward(): SReward
        {
            return this._reward;
        }

        public set itemDataArray(arg1: Array<any>)
        {
            this._itemDataArray = arg1;
            return;
        }

        public get itemDataArray(): Array<any>
        {
            return this._itemDataArray;
        }

        public get rewardArray(): Array<any>
        {
            return this._rewardArray;
        }

        public parse(): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=null;
            if (rank >= 1) 
            {
                loc1 = JSON.deserialize(rewards);
                var loc4=0;
                var loc5=loc1;
                for(loc3 of loc5) 
                {
                    loc2 = new SReward();
                    loc2.type = loc3.type;
                    loc2.code = loc3.code;
                    loc2.num = loc3.num;
                    if (loc2.type == EReward._ERewardItem) 
                    {
                        this._itemData = new ItemData(loc2.code);
                        this._itemData.itemAmount = loc2.num;
                        this._itemDataArray.push(this._itemData);
                        continue;
                    }
                    this._reward = loc2;
                    this._rewardName = GameDefConfig.instance.getERewardName(loc2.type);
                    this._rewardNum = loc2.num;
                    this._rewardArray.push(loc2);
                }
            }
            return;
        }

        /* internal */ /* var */_rewardArray: Array<any>;

        /* internal */ /* var */_itemDataArray: Array<any>;

        /* internal */ /* var */_itemData: ItemData;

        /* internal */ /* var */_rewardNum: int;

        /* internal */ /* var */_rewardName: string;

        /* internal */ /* var */_reward: SReward;
    }
